import { combineReducers } from 'redux';
import { actions } from '../actions/actionAsyncDemo';


const InitialData = {
    begin: '1990',
    end: '2020',
    year: '2017',
    month: '11',
    day: '2',
};

function reducer(state = {}, action) {
    var newState = { ...InitialData, ...state };
    var data = action ? action.data : {};

    switch (action.type) {
        case actions['CHANGE_YEAR']:
            newState.year = action.data;
            break;
        case actions['CHANGE_MONTH']:
            newState.month = action.data;
            break;
        case actions['CHANGE_DAY']:
            newState.day = action.data;
            break;
    }
    return newState;
}

export default reducer